/**
 * 
 */
package cn.netjava.softkid.chapter09;

import java.io.File;
import java.io.FileFilter;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @author softkid
 *
 */
public class FindFileUseFileFilter implements FileFilter
{

	@Override
	public boolean accept(File pathname) {
		return pathname.getName().matches(".+.java");
		
	}
	public void  findFile(String dir,String suffix)
	{
		File f = new File(dir);
		File[] files = f.listFiles();
		if(null==files)
			return;
		for(int i=0;i<files.length;i++)
		{
			File temp = files[i];
			if(temp.isFile()&&accept(temp))
			{
				System.out.println(temp);
			}
			if(temp.isDirectory())
			{
				findFile(temp.getAbsolutePath(),suffix);
			}
		}
	}

}
